#pragma once

#include <map>
#include <string>

#include "myBaseIEObject.h"

class myBaseIEObj;
class myExternal:
	public IDispatch
{
public:
	typedef std::map<std::wstring, int> CommandIDMap;
	myExternal(myBaseIEObj *pIEObj);

	STDMETHODIMP_(ULONG) AddRef() { return 1 ; }
	STDMETHODIMP_(ULONG) Release() { return 1 ; }
	STDMETHODIMP QueryInterface(REFIID, void**) ;

	//IDispatch
	STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) ;
	STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) ;
	STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) ;
	STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) ;

private:
	HRESULT onGetName(DISPPARAMS* /*pDispParams*/, VARIANT* /*pVarResult*/);
private:
	CommandIDMap m_cmdMap;
	myBaseIEObj *m_pIEObj;
};